package com.ww.scm.repository.pub;

import java.util.Date;

import org.springframework.stereotype.Component;

import com.ww.core.orm.hibernate.HibernateDao;
import com.ww.core.utils.DateUtils;
import com.ww.scm.constants.Constants;
import com.ww.scm.entity.pub.Dictionary;
import com.ww.scm.entity.pub.DictionaryType;

//Spring Bean的标识.
@Component
public class DictionaryTypeRepository extends HibernateDao<DictionaryType, String>{

	
	public void delete(Dictionary dictionary,String operator) {
		Date nowDate=new Date();
		dictionary.setSysFlag(Constants.SYS_FLAG_DELETED);
		dictionary.setLastModifier(operator);
		dictionary.setLastModifiedTime(DateUtils.formatDateHms(nowDate));
		getSession().save(dictionary);
	}
	
	public void delete(String id,String operator) {
		DictionaryType dictionaryType=get(id);
		Date nowDate=new Date();
		dictionaryType.setSysFlag(Constants.SYS_FLAG_DELETED);
		dictionaryType.setLastModifier(operator);
		dictionaryType.setLastModifiedTime(DateUtils.formatDateHms(nowDate));
		save(dictionaryType);
	}
}
